<!DOCTYPE html>
<title>Tests that adding a text track does not make controls visible.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-controls.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");
    video.src = "content/test.ogv";

    video.oncanplaythrough = t.step_func_done(function() {
        // Initial state: no text tracks, controls should not be visible.
        assert_equals(video.textTracks.length, 0);
        assert_false(video.controls);

        // Add a text track, controls should not become visible.
        video.addTextTrack("captions");
        assert_equals(video.textTracks.length, 1);
        assert_false(video.controls);

        // Enable controls.
        video.setAttribute("controls","controls");
        assert_equals(video.textTracks.length, 1);
        assert_true(video.controls);
        assert_not_equals(internals.shadowRoot(video).firstChild, null);
        var panel = mediaControlsButton(video, "panel");
        assert_not_equals(panel.style["display"], "none");
    });
});
</script>